<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" name="uname" value="john">
    <input type="text" name="psd" value="123">
    <button>登23录</button>

    <script>
        let url="http://192.168.31.164:3000/users"
        document.querySelector('button').addEventListener('click',()=>{
            let uname=document.querySelector('input[name="uname"]').value
            let psd=document.querySelector('input[name="psd"]').value
            fetch(url+"?name="+uname+"&psd="+psd)
            .then(resp=>resp.json())
            .then(users=>{
                if(users.length>0){
                    window.ReactNativeWebView.postMessage(JSON.stringify(users[0]))
                }
                else{
                    alert('用户名或密码错')
                }
            })
        })
    </script>
</body>
</html>